package zuoye.zuoye05;

import java.util.Scanner;

public class Demo33 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] nums = {12, 23, 34, 45, 56, 67, 78, 89};
        int[] newArray = new int[nums.length + 1];
        System.out.println("请输入一个整数");
        int inputNum = input.nextInt();
        int arrayIndex = -1;
        //数组内增加一个数
        for (int i = 0; i < nums.length; i++) {
            newArray[i] = nums[i];
            arrayIndex = inputNum;
        }

        newArray[nums.length] = arrayIndex;

        //冒泡排序（从小到大）
        for (int i = 0; i < newArray.length - 1; i++) {
            for (int j = 0; j < newArray.length - 1; j++) {
                if (newArray[j] > newArray[j + 1]) {
                    int temp = newArray[j];
                    newArray[j] = newArray[j + 1];
                    newArray[j + 1] = temp;

                }
            }
        }
        for (int e : newArray) {
            System.out.print(e + " ");
        }
    }
}
